<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<%@ include file="/common/import.jsp" %>
<script>
  var thsTitle = "修改标的规则";
  var objName = "item";
</script>
</head>
<body>
<!-- 正文开始 -->
<div id="main" class="easyui-tabs">
	<c:if test="${bidItem.bidMode=='1' || bidItem.bidMode=='2'}">
	<div title="阶梯加价幅度" style="margin:5px;">
	<form id="addItemForm1">
    <input type="hidden" name="itemId" value="${bidItem.itemId}">
		<font color="red">如果按阶梯设置加价幅度，请用 | 线隔开！</font>
		<table class="info" cellspacing="1" cellpadding="0">
			<tr>
				<th>阶梯分组：<font color="red">*</font></th>
				<td><input type="text" name="incrementGroup"  value="${bidItem.incrementGroup}" size="55" class="easyui-validatebox validatebox-text" 
			validtype="length[1,50]"	required="true"  missingMessage="请输入阶梯分组"  maxlength="55"  invalidMessage="最多可输入50个字符"  title="阶梯分组最多可输入50个字符" /></td>
			</tr>
			<tr>
				<th>加价幅度分组：<font color="red">*</font></th>
				<td><input type="text" name="incrementValue"  value="${bidItem.incrementValue}" size="55" class="easyui-validatebox validatebox-text" 
			validtype="length[1,50]"	required="true"  missingMessage="请输入加价幅度"  maxlength="55"  invalidMessage="最多可输入50个字符"  title="加价幅度最多可输入50个字符" /></td>
			</tr>
		</table>
		<center>
			<a class="easyui-linkbutton" iconCls="icon-ok" onclick="editItem(1);">保存</a>
		</center>	</form>	
	</div>
	<div title="延牌规则" style="margin:5px;">
	<form id="addItemForm2">
    <input type="hidden" name="itemId"  value="${bidItem.itemId}">
		<table class="info" cellspacing="1" cellpadding="0">
			<tr>
				<th>是否延牌：</th>
				<td>
					<input type="radio" name="delayControl" value="T" onclick="ifYanPai();"  <c:if test="${bidItem.delayControl == 'T' }"> checked="checked" </c:if>  />延牌，
					<input type="radio" name="delayControl"  value="F" onclick="ifYanPai();"  <c:if test="${bidItem.delayControl != 'T' }"> checked="checked" </c:if> />不延牌
				</td>
			</tr>
			<tr id="delay_type">
				<th>延牌类型：</th>
				<td>
					<input type="radio" name="delayUnit"  value="m" onclick="$('#dt').html('分');"  <c:if test="${bidItem.delayUnit eq 'm' }"> checked="checked" </c:if>  />分，
					<input type="radio" name="delayUnit"  value="h"  onclick="$('#dt').html('小时');"   <c:if test="${bidItem.delayUnit eq 'h' }"> checked="checked" </c:if>  />小时，
					<input type="radio" name="delayUnit"  value="d"  onclick="$('#dt').html('天');"   <c:if test="${bidItem.delayUnit eq 'd' }"> checked="checked" </c:if>  />天，
					<input type="radio" name="delayUnit"  value="wd"  onclick="$('#dt').html('工作日');"   <c:if test="${bidItem.delayUnit eq 'wd' }"> checked="checked" </c:if>  />工作日
				</td>
			</tr>
			<tr id="delay_week">
				<th>延牌周期：</th>
				<td><input type="text" name="delayPeriod" id="delayPeriod" value="${bidItem.delayPeriod}" size="2" maxlength="3" onkeyup="value=this.value.replace(/[^\d]/g,'')"  class="easyui-validatebox validatebox-text" 
			validtype="number"	required="true"  missingMessage="请输入延牌周期"  invalidMessage="必须为1~3位非负数字"  title="延牌周期[1~3位非负数字]"  /><font id="dt"></font></td>
			</tr>
			<tr id="delay_time">
				<th>最长延牌时间：</th>
				<td><input type="text" name="delayDeadTime" id="delayDeadTime"  value="${bidItem.delayDeadTime}" size="18" readonly="true" showSeconds="true" required="true" editable="false" class="easyui-datetimebox" /> </td>
			</tr>
		</table>
		<center>
			<a class="easyui-linkbutton" iconCls="icon-ok" onclick="editItem(2);">保存</a>
		</center></form>	
	</div>
	</c:if>
	<c:if test="${bidItem.bidMode !='7' }">
	<div title="行使优先权规则" style="margin:5px;">
	<form id="addItemForm3">
	<input type="hidden" name="itemId"  value="${bidItem.itemId}">
		<table class="info" cellspacing="1" cellpadding="0">
		<c:if test="${bidItem.bidMode=='1' || bidItem.bidMode=='2'}">
			<tr>
				<th>是否允许过程行权：</th>
				<td>
					<input type="radio" name="ifRight"  value="T" <c:if test="${bidItem.ifRight == 'T'}"> checked="checked" </c:if>  />允许，
					<input type="radio" name="ifRight"  value="F" <c:if test="${bidItem.ifRight != 'T'}"> checked="checked" </c:if> />不允许
				</td>
			</tr>
		</c:if>		
			<tr>
				<th>是否有老股东事后行权：</th>
				<td>
					<input type="radio" name="allowEndPrio"  value="T" <c:if test="${bidItem.allowEndPrio == 'T'}">checked="checked"</c:if> />有，
					<input type="radio" name="allowEndPrio"  value="F" <c:if test="${bidItem.allowEndPrio != 'T' }">checked="checked"</c:if> />没有
				</td>
			</tr>
			<tr>
				<th>老股东事后行权方式：</th>
				<td>
					<input type="radio" name="allowHallPrio"  value="T"  <c:if test="${bidItem.allowHallPrio == 'T'}">checked="checked"</c:if> />场内，
					<input type="radio" name="allowHallPrio"  value="F"  <c:if test="${bidItem.allowHallPrio != 'T'}">checked="checked"</c:if> />场外
				</td>
			</tr>
			<c:if test="${bidItem.bidMode=='1' || bidItem.bidMode=='2'}">
			<tr>
				<th>是否允许最高报价人加价：</th>
				<td>
					<input type="radio" name="allowAdd"  value="T"  onclick="addPrice('T')" <c:if test="${bidItem.allowAdd == 'T'}">checked="checked"</c:if> />允许，
					<input type="radio" name="allowAdd"  value="F"  onclick="addPrice('F')"  <c:if test="${bidItem.allowAdd != 'T'}">checked="checked"</c:if> />不允许
				</td>
			</tr>
			<tr>
				<th>最高报价人加价时间：</th>
				<td>
					<input type="text" name="allowAddTime"  value="${bidItem.allowAddTime == null?3 : bidItem.allowAddTime}" size="2" maxlength="2"   class="easyui-validatebox validatebox-text" 
			validtype="number"	required="true"  missingMessage="请输入最高报价人加价时间"  invalidMessage="必须为1~2位非负数字"  title="最高报价人加价时间[1~2位非负数字]"  />分钟
				</td>
			</tr>
			</c:if>
			<tr>
				<th>股东行权时间：</th>
				<td>
					<input type="text" name="allowPrioTime"  value="${bidItem.allowPrioTime == null?3 : bidItem.allowPrioTime}" size="2" maxlength="2"   class="easyui-validatebox validatebox-text" 
			validtype="number"	required="true"  missingMessage="请输入股东行权时间"  invalidMessage="必须为1~2位非负数字"  title="股东行权时间[1~2位非负数字]" />分钟
				</td>
			</tr>
		</table>	
		<center>
			<a class="easyui-linkbutton" iconCls="icon-ok" onclick="editItem(3);">保存</a>
		</center></form>	
	</div>
	</c:if>
	<c:if test="${sessionMode == '1'}">
	<div title="启用V型竞价" style="margin:5px;">
	<form id="addItemForm4">
	<input type="hidden" name="itemId"  value="${bidItem.itemId}">
		<table class="info" cellspacing="1" cellpadding="0">
			<tr>
				<th>是否启用：</th>
				<td>
					<input type="radio" name="vFlag"  value="F" onclick="ifUseV()" <c:if test="${bidItem.vFlag == null || bidItem.vFlag == 'F'}"> checked="checked" </c:if> /> 不启用V型竞价，
					<input type="radio" name="vFlag"  value="T" onclick="ifUseV()" <c:if test="${bidItem.vFlag == 'T'}"> checked="checked" </c:if>  /> 启用V型竞价
				</td>
			</tr>	
			<tr id="vx_tr1">
				<th>降价幅度：</th>
				<td>
					<input type="text" name="fallDecrement"  value="${bidItem.fallDecrement==null?0 : bidItem.fallDecrement}" size="8" maxlength="20"   class="easyui-validatebox validatebox-text" 
			validtype="number"	required="true"  missingMessage="请输入降价幅度"  invalidMessage="必须为1~20位非负数字"  title="降价幅度" />（${bidItem.priceUnit} ${bidItem.currency}） 不设请输入0
				</td>
			</tr>	
			<tr id="vx_tr2">
				<th>降价周期：</th>
				<td>
					<input type="text" name="fallLimitTime"  value="${bidItem.fallLimitTime==null?0 : bidItem.fallLimitTime}" size="8"  maxlength="3"   class="easyui-validatebox validatebox-text" 
			validtype="number"	required="true"  missingMessage="请输入降价周期"  invalidMessage="必须为1~3位非负数字"  title="降价周期[1~3位非负数字]" />（秒） 不设请输入0
				</td>
			</tr>
			<tr id="vx_tr3">
				<th>降价底线：</th>
				<td>
					<input type="text" name="fallLowerstPrice"  value="${bidItem.fallLowerstPrice==null?0 : bidItem.fallLowerstPrice}" size="8" maxlength="20"   class="easyui-validatebox validatebox-text" 
			validtype="number"	required="true"  missingMessage="请输入降价底线"  invalidMessage="必须为1~20位非负数字"  title="降价底线[1~20位非负数字]" />（${bidItem.priceUnit} ${bidItem.currency}） 不设请输入0
				</td>
			</tr>
		</table>	
		<center>
			<a class="easyui-linkbutton" iconCls="icon-ok" onclick="editItem(4);">保存</a>
		</center></form>
	</div></c:if>
	<c:if test="${bidItem.bidMode=='1'}">
	<div title="保留价一口价" style="margin:5px;">
	<form id="addItemForm5">
	<input type="hidden" name="itemId"  value="${bidItem.itemId}">
		<table class="info" cellspacing="1" cellpadding="0">
			<tr>
				<th>一口价：</th>
				<td>
					<input type="text" name="oncevalue"  value="${bidItem.oncevalue==null?0 : bidItem.oncevalue}" size="8" maxlength="20"   class="easyui-validatebox validatebox-text" 
			validtype="number"	required="true"  missingMessage="请输入一口价"  invalidMessage="必须为1~20位非负数字"  title="一口价[1~20位非负数字]" /> 不设请输入0
				</td>
			</tr>		
			<tr>
				<th>是否有保留价：</th>
				<td>
					<input type="text" name="holdvalue"  value="${bidItem.holdvalue==null?0 : bidItem.holdvalue}" size="8" maxlength="20"   class="easyui-validatebox validatebox-text" 
			validtype="number"	required="true"  missingMessage="请输入保留价"  invalidMessage="必须为1~20位非负数字"  title="保留价[1~20位非负数字]" /> 不设请输入0
				</td>
			</tr>
			<tr>
				<th>是否允许连续报价：</th>
				<td>
					<input type="radio" name="allowRepeat"  value="T" <c:if test="${bidItem.allowRepeat == 'T'}"> checked="checked" </c:if>  />允许，
					<input type="radio" name="allowRepeat"  value="F" <c:if test="${bidItem.allowRepeat != 'T'}"> checked="checked" </c:if> />不允许
				</td>
			</tr>	
		</table>	
		<center>
			<a class="easyui-linkbutton" iconCls="icon-ok" onclick="editItem(5);">保存</a>
		</center></form>
	</div>
	</c:if>
	<div title="是否按单价报价" style="margin:5px;">
	<form id="addItemForm6">
	<input type="hidden" name="itemId"  value="${bidItem.itemId}">
		<table class="info" cellspacing="1" cellpadding="0">
			<tr>
				<th>是否按单价报价：</th>
				<td>
					<input type="radio" name="priceFlag"  value="1" onclick="ifUnitPrice();" <c:if test="${bidItem.priceFlag == '1'}"> checked="checked" </c:if> /> 按单价，
					<input type="radio" name="priceFlag"  value="0" onclick="ifUnitPrice();" <c:if test="${bidItem.priceFlag != '1'}"> checked="checked" </c:if>  /> 按整体
				</td>
			</tr>
			<tr>
				<th colspan="2">
					如果按单价报价的话，请核查起始价格是否是单价,并在下面输入标的的数量和单位。
				</th>
			</tr>		
			<tr>
				<th>标的数量：</th>
				<td>
					<input type="text" name="itemNum"  value="${bidItem.itemNum}" size="10" maxlength="50"   class="easyui-validatebox validatebox-text" 
			validtype="number"	required="true"  missingMessage="请输入标的数量"  invalidMessage="必须为1~50位非负数字"  title="标的数量"  />
					比如80平方米， <font color=red>80</font> 输入在此框中，<font color=red>平方米</font>输入在下面框中。
				</td>
			</tr>
			<tr>
				<th>数量单位：</th>
				<td>
					<input type="text" name="itemUnitName"  value="${bidItem.itemUnitName}" size="10" maxlength="20"   class="easyui-validatebox validatebox-text" 
			validtype="length[1,6]"	required="true"  missingMessage="请输入数量单位"  invalidMessage="最多为6个中文字符"  title="数量单位"   />
					比如：平方米 吨等
				</td>
			</tr>
		</table>		
		<center>
			<a class="easyui-linkbutton" iconCls="icon-ok" onclick="editItem(6);">保存</a>
		</center></form>
	</div>
	<c:if test="${bidItem.bidMode=='1' || bidItem.bidMode=='2'}">
	<div title="设置竞买人行权级别" style="padding:5px;">
	<div id="setLevel" style="display:none;">
		<div class="searchForm"><form id="pVip_form">
			<input type="hidden" name="page" value="1"/>
			<input type="hidden" name="rows" value="5"/>
			<input type="hidden" name="itemId"  value="${bidItem.itemId}">
			<input type="hidden" name="vipType" value="p">
		</form></div>
		<table id="pVip_table" class="info" cellspacing="1" cellpadding="0">
			<tr>
				<th width='5%'>序号</th>
				<th width='20%'>行权人登录名</th>
				<th width='20%'>行权人名称</th>
				<th width='20%'>行权级别</th>
				<th width='10%' class='th_center'>操作</th>
			</tr>
		</table>
		<div id="pVip_page" class="page"></div>
		<script type="text/template" id="pVip_html">
			<? for ( var i = 0; i < rows.length; i++) {?>
			<tr>
			<td><?=(i+1)?></td>
			<td><?=rows[i].userEname?></td>
			<td><?=rows[i].userCname?></td>
			<td><?=rows[i].vipLevel?></td>
			<td>
				<a class="mybutton"  onclick="delVip('<?=rows[i].vipId?>');">删除</a> 
			</td>
			</tr>
			<?}?>  		
		</script>
		<div class="searchForm"><form id="pVipAddForm">
			<input type="hidden" name="itemId"  value="${bidItem.itemId}">
			<c:if test="${sessionType!='1' && sessionType!='2'}">
				<input type="hidden" name="sessionId"  value="0">
			</c:if>
			<c:if test="${sessionType=='1' ||sessionType=='2'}">
				<input type="hidden" name="sessionId"  value="${bidItem.sessionId}">
			</c:if>
			<input type="hidden" name="vipType"  value="p">
			登录名称：<input type="text" name="userEname"  value="" class="easyui-validatebox validatebox-text" 
			validtype="length[1,50]"	required="true"  missingMessage="请输入登录名称"  maxlength="60"
				invalidMessage="最多可输入50个字符"  title="登录名称最多可输入50个字符"  /> 
			名称：<input type="text" name="userCname"  value="" class="easyui-validatebox validatebox-text" 
			validtype="length[1,33]"	required="true"  missingMessage="请输入名称"  maxlength="50"
				invalidMessage="最多可输入33中文字符"  title="名称最多可输入33中文字符" />
			行权级别：
			<select name="vipLevel" >
			 <option value="1">1级</option>
			 <option value="2">2级</option>
			 <option value="3">3级</option>
			 <option value="4">4级</option>
			 <option value="5">5级</option>
			 <option value="6">6级</option>
			 <option value="7">7级</option>
			 <option value="8">8级</option>
			</select>
			<a class="easyui-linkbutton"  iconCls="icon-add" onclick="addPvip();">增加新的行权人</a>
			<a class="easyui-linkbutton"  iconCls="icon-no" onclick="clearFormById('pVipAddForm');">清空</a>
		</form></div>
	</div>
	<div id="notSetLevel" style="display:none;">
		<center>不允许过程行权,不需要设置优先权人级别！</center>
	</div>
	</div>
	</c:if>
	<c:if test="${bidItem.bidMode !='7' }">
	<div title="设置事后行权股东" style="margin:5px;">
	<div id="setEnd" style="display:none;">
		<div class="searchForm"><form id="eVip_form">
			<input type="hidden" name="page" value="1"/>
			<input type="hidden" name="rows" value="5"/>
			<input type="hidden" name="itemId"  value="${bidItem.itemId}">
			<input type="hidden" name="vipType" value="e">
		</form></div>
		<table id="eVip_table" class="info" cellspacing="1" cellpadding="0">
			<tr>
				<th width='5%'>序号</th>
				<th width='20%'>行权人登录名</th>
				<th width='20%'>行权人名称</th>
				<th width='10%' class='th_center'>操作</th>
			</tr>
		</table>
		<div id="eVip_page" class="page"></div>
		<script type="text/template" id="eVip_html">
			<? for ( var i = 0; i < rows.length; i++) {?>
			<tr>
			<td><?=(i+1)?></td>
			<td><?=rows[i].userEname?></td>
			<td><?=rows[i].userCname?></td>
			<td>
				<a class="mybutton"  onclick="delVip('<?=rows[i].vipId?>');">删除</a> 
			</td>
			</tr>
			<?}?>  		
		</script>
		<div class="searchForm"><form id="eVipAddForm">
			<input type="hidden" name="itemId"  value="${bidItem.itemId}">
			<c:if test="${sessionType!='1' && sessionType!='2'}">
				<input type="hidden" name="sessionId"  value="0">
			</c:if>
			<c:if test="${sessionType=='1' ||sessionType=='2'}">
				<input type="hidden" name="sessionId"  value="${bidItem.sessionId}">
			</c:if>
			<input type="hidden" name="vipType"  value="e">
			<input type="hidden" name="vipLevel"  value="9" /><!-- 默认缺省行权最高9级 -->
			登录名称：<input type="text" name="userEname"  value=""  class="easyui-validatebox validatebox-text" 
			validtype="length[1,50]"	required="true"  missingMessage="请输入登录名称"  maxlength="60"
				invalidMessage="最多可输入50个字符"  title="登录名称最多可输入50个字符" /> 
			股东名称：<input type="text" name="userCname"  value="" class="easyui-validatebox validatebox-text" 
			validtype="length[1,33]"	required="true"  missingMessage="请输入股东名称"  maxlength="50"
				invalidMessage="最多可输入33中文字符"  title="股东名称最多可输入33中文字符" />
			<a class="easyui-linkbutton"  iconCls="icon-add" onclick="addEvip();">增加新的股东</a>
			<a class="easyui-linkbutton"  iconCls="icon-no" onclick="clearFormById('eVipAddForm');">清空</a>
		</form></div>
	</div>
	<div id="notSetEnd" style="display:none;">
		<center>不允许事后行权,不需要设置事后行权的股东！</center>
	</div>
	</div>
	</c:if>
</div>


<!-- 正文结束 -->
<%//@ include file="/common/top.jsp" %>
</body>
</html>
<script>
var cType = ""; //p：表示当前是管理过程行权人，e:表示当前是管理事后行权人
function editItem(i){
	var itemId = $("#addItemForm"+i).find("input[name='itemId']").val();
	if(i==1){//校验阶梯、加价幅度		
		var groups = $("#addItemForm"+i).find("input[name='incrementGroup']").val();
		var values = $("#addItemForm"+i).find("input[name='incrementValue']").val();
		var arrayGroup = groups.split("|");
		var arrayValue = values.split("|");	
		if(arrayGroup.length == arrayValue.length){
			if(arrayGroup.length>0){
				for (var k=0;k<arrayGroup.length;k++){
					if(isNaN(arrayGroup[k])){
						alert("请输入正确的阶梯分组数据");
						return;
					}else{
						if(arrayGroup[k]<=0){
							alert("阶梯分组中的数据必须大于0");
							return;
						}
					}
				}
				for (var k=0;k<arrayValue.length;k++){
					if(isNaN(arrayValue[k])){
						alert("请输入正确的加价幅度分组数据");
						return;
					}else{
						if(arrayValue[k]<=0){
							alert("加价幅度分组中的数据必须大于0");
							return;
						}
					}
				}
			}
		}else{
			alert("阶梯分组与加价幅度分组数据不匹配！");
			return;
		}				
	}
	if(i==2){//延牌
		var val = $("#addItemForm2").find("input[name='delayControl']:checked").val();
		if(val == 'T'){
			var firstBidTimePre = '${bidItem.firstBidTimePre}';
			//var delayDeadTime = $("#delayDeadTime").val();
			var delayDeadTime = $('#delayDeadTime').datetimebox('getValue');
			if(firstBidTimePre>=delayDeadTime){
				alert("最长延牌时间必须大于竞价结束时间！");
				return ;
			}
		}
	}
	editSubmit(objName,itemId,"addItemForm"+i);
}
//更新后回调方法
function editCallBack(flag,objName){
	if(flag=="T"){
		alert("修改成功！");
		parent.notBeginListSearch();
		//parent.closeItemWindow();
		item_allowEndPrio= $('#addItemForm3').find("input[name='allowEndPrio']:checked").val();
		item_ifRight = $('#addItemForm3').find("input[name='ifRight']:checked").val();
	}else{
		alert("修改失败！");
	}
}
function pVipSearch(){
	searchSubmit("vip","pVip");
}
function eVipSearch(){
	searchSubmit("vip","eVip");
}
function addPvip(){
	addSubmit("vip","pVipAddForm");
}
function addEvip(){
	addSubmit("vip","eVipAddForm");
}
function addCallBack(flag,msg,objName){
	if(flag=="T"){
		if(cType=="p"){
		    clearFormById('pVipAddForm');
			pVipSearch();
		}else if(cType=="e"){
		    clearFormById('eVipAddForm');
			eVipSearch();
		}
	}else{
		alert("增加失败！"+msg);
	}
}
function delVip(vid){
	if(confirm("确定要删除吗？")){
		delSubmit("vip",vid);
	}
}
function delCallBack(flag,objName){
	if(flag=="T"){
		if(cType=="p"){
			pVipSearch();
		}else if(cType=="e"){
			eVipSearch();
		}
		
	}else{
		alert("删除失败！");
	}
}
function openVipLevel(){
	cType = "p";
	//var ifRight = $('#addItemForm3').find("input[name='ifRight']:checked").val();
	//alert(ifRight);
	if(item_ifRight=="T"){
		pVipSearch();
		$("#setLevel").show();
		$("#notSetLevel").hide();
	}else{
		$("#setLevel").hide();
		$("#notSetLevel").show();
	}
}
function openVipEnd(){
	cType = "e";
	//var allowEnd = $('#addItemForm3').find("input[name='allowEndPrio']:checked").val();
	//alert(allowEnd);
	if(item_allowEndPrio=="T"){
		eVipSearch();
		$("#setEnd").show();
		$("#notSetEnd").hide();
	}else{
		$("#setEnd").hide();
		$("#notSetEnd").show();
	}
}
var item_allowEndPrio="${bidItem.allowEndPrio}";
var item_ifRight="${bidItem.ifRight}";
$(function(){
	$("#main").tabs({
		onSelect:function(title){  
			if("设置竞买人行权级别"==title){
				openVipLevel();
			}else if("设置事后行权股东"==title){
				openVipEnd();
			}
		}
	});
	
	ifYanPai();
	if('${sessionMode}' == '1'){
		ifUseV();
	}
	ifUnitPrice();
	addPrice('${bidItem.allowAdd}');
});
//[是否延牌]联动是否校验
function ifYanPai(){
  var val = $("#addItemForm2").find("input[name='delayControl']:checked").val();
	if(val == "T"){
		$("#delay_type").show();
		   $("#delay_week").show();
		   $("#delay_time").show();
	   $('#delayPeriod').validatebox({required:true});
	   $('#delayDeadTime').datetimebox({required:true});
	}else{
		$("#delay_type").hide();
		   $("#delay_week").hide();
		   $("#delay_time").hide();
	   $('#delayPeriod').validatebox({required:false});
	   $('#delayDeadTime').datetimebox({required:false});
	}
}

//[是否启用V型]联动是否校验和显示相关属性
function ifUseV(){
 var val = $("#addItemForm4").find("input[name='vFlag']:checked").val();
 if("T"==val){
   $("#vx_tr1").show();
   $("#vx_tr2").show();
   $("#vx_tr3").show();
   $("#addItemForm4").find("input[name='fallDecrement']").validatebox({required:true});
   $("#addItemForm4").find("input[name='fallLimitTime']").validatebox({required:true});
   $("#addItemForm4").find("input[name='fallLowerstPrice']").validatebox({required:true});
 }else{
   $("#vx_tr1").hide();
   $("#vx_tr2").hide();
   $("#vx_tr3").hide();
   $("#addItemForm4").find("input[name='fallDecrement']").validatebox({required:false});
   $("#addItemForm4").find("input[name='fallLimitTime']").validatebox({required:false});
   $("#addItemForm4").find("input[name='fallLowerstPrice']").validatebox({required:false});
 }
}
//[是否按单价]关联字段操作
function ifUnitPrice(){
var val = $("#addItemForm6").find("input[name='priceFlag']:checked").val();
 if("1"==val){
   $("#addItemForm6").find("input[name='itemNum']").validatebox({required:true});
   $("#addItemForm6").find("input[name='itemUnitName']").validatebox({required:true});
   $("#addItemForm6").find("input[name='itemNum']").removeAttr("readonly");
   $("#addItemForm6").find("input[name='itemUnitName']").removeAttr("readonly");
 }else{
   $("#addItemForm6").find("input[name='itemNum']").validatebox({required:false});
   $("#addItemForm6").find("input[name='itemUnitName']").validatebox({required:false});
   $("#addItemForm6").find("input[name='itemNum']").val(1);
   $("#addItemForm6").find("input[name='itemUnitName']").val("");
   $("#addItemForm6").find("input[name='itemNum']").attr("readonly","true");
   $("#addItemForm6").find("input[name='itemUnitName']").attr("readonly","true");
 }
}

function addPrice(flag){
	if( flag != "T"){
	   $("#addItemForm3").find("input[name='allowAddTime']").val("0");
	}else{
	 if($("#addItemForm3").find("input[name='allowAddTime']").val()=="0")
	   $("#addItemForm3").find("input[name='allowAddTime']").val("3");
	}
}
</script>